<ui:composition 
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	template="/templates/layout.xhtml">

	
	<ui:define name="content">
	<h:outputStylesheet name="css/login.css" />
   		#{loginBean.checkState()}
		<h:form id="loginForm" class="login" style="margin : 10px" autocomplete="on">
			<h:panelGrid id="grid" columns="3" styleClass="form" >
			
				<p:outputLabel for="username" value="Username:"/>
				<p:inputText id="username" value="#{loginBean.login}" required="true" styleClass="input" autocomplete="on" />
			    <!-- <p:message for="username" /> -->
				    
				<p:outputLabel for="password" value="Password:"/>
				<p:password id="password" value="#{loginBean.password}"  required="true" styleClass="input"/>
				<!-- <p:message for="password" /> -->
				
				<p:outputLabel for="url" value="Jira URL:"/>
				<p:inputText id="url"  value="#{loginBean.url}" required="true" disabled="#{loginBean.adminSwitch}" styleClass="input" autocomplete="on"/>
				<!-- <p:message for="url" /> -->
						
				<p:outputLabel for="isAdmin" value="Is Admin"/>
				<p:selectBooleanCheckbox id="isAdmin" value="#{loginBean.adminSwitch}" styleClass="input"  >
					<p:ajax listener="#{loginBean.isAdminValueListener}" update="url"/>
				</p:selectBooleanCheckbox>
				
				<br/>
				<p:outputLabel for="rememberMe" value="Remember Me"/>
				<p:selectBooleanCheckbox id="rememberMe" styleClass="input"/>
				
				<p:commandButton id="submit" value="Login"   actionListener="#{loginBean.doLogin}" 
						update="grid, isAdmin" styleClass="button" onstart="statusDialog.show();" onsuccess="statusDialog.hide();"/>			
				</h:panelGrid>
				
				<p:messages id="messages" showDetail="true" autoUpdate="true" closable="true" />
				
		</h:form>
		
		<p:dialog id="loadStatus" widgetVar="statusDialog" modal="true" draggable="false" closable="false" 
			resizable="false" showHeader="false"  style="background-color: transparent; box-shadow: none; border: none;"  >
					<p:graphicImage  value="/resources/img/loading.gif" />	
		</p:dialog>
    </ui:define>
    
</ui:composition>